<?php
  //Buffer larger content areas like the main page content
  ob_start();
?>
<?php
require_once("auth.php");
include("config.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Payments</title>
<script type="text/javascript" src="js/validationpay.js"></script>
<script>
var count=0;

function load(thediv, thefile) /* 2 parameters passed into here: the id of the div container and the name of the page to go to */
{  
    if (window.XMLHttpRequest)
    {
        xmlhttp = new XMLHttpRequest();
    }
    else
    {
        xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');  
    }
    xmlhttp.addEventListener("error", transferFailed, false);  
    xmlhttp.onreadystatechange = function()
    {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
        {
            document.getElementById( thediv ).innerHTML = xmlhttp.responseText;
        }
    }  
 
   xmlhttp.open('GET', thefile, true);
    xmlhttp.send();
	    
}

function transferFailed(evt) {  
  alert("An error occurred while transferring the file.");  
}

</script>

</head>

<body>
<?php 
include("config.php");
if(isset($_REQUEST['id']))
{
$id=$_REQUEST['id'];
$data=mysql_query("select * from payment where PaymentID='$id'");
$no=mysql_num_rows($data);
if($no!=0)
{
	while($rec=mysql_fetch_assoc($data))
	{

?>

<form action="updatepayments.php" method="post"  enctype="multipart/form-data" id="frmPayments">
<fieldset >
<legend style="color:#FD0002">Update Payments </legend>
			<div id="status"></div>
<table align="center" width="50%">
<tr> <td>Payment Type</td><td><input type="hidden" value="<?php echo $id; ?>" name="id" />
<input type="text" name="txtPaymentType" id="txtPaymentType" value="<?php echo $rec['PaymentType']; ?>"></td></tr>

<tr> <td>Allowed</td><td><input type="text" id="txtAllowed" name="txtAllowed" value="<?php echo $rec['Allowed']; ?>"></td></tr>

<tr><td><input type="button" value="Update Payments" name="btnUpdatePayments"  onclick="validateForm2('updatepayments.php','frmPayments','thediv','<img src=\'pleasewait.gif\'>');"/></td></tr>
</table>

</fieldset>
  	</form>
	
	
<?php
}}
}
else
{
?>

<form action="addpayments.php" method="post"  enctype="multipart/form-data" id="frmPayments">
<fieldset >
<legend style="color:#FD0002">Add Payments </legend>
			<div id="status"></div>
<table align="center" width="50%">
<tr> <td>Payment Type</td><td><input type="text" name="txtPaymentType" id="txtPaymentType">
						</td></tr>
<tr> <td>Allowed</td><td><input type="text" id="txtAllowed" name="txtAllowed"></td></tr>
<tr><td><input type="button" value="Add Payments" name="btnAddPayments" onclick="validateForm2('addpayments.php','frmPayments','thediv','<img src=\'pleasewait.gif\'>');"  /></td></tr>
</table>

</fieldset>
  	</form>
	<?php
	}
	?>
	
</body>
</html>
 <?php
  //Assign all Page Specific variables
  $pagemaincontent = ob_get_contents();
  ob_end_clean();
  $pagetitle = "Payments";
  //Apply the template
  include("master.php");
?>    